package recursion;

/**
 * @author K024851
 * @ClassName recursion 递归
 * @date 2021/11/9 11:27
 */
public class recursion {

    public static void main(String[] args) {
//        print(4);//打印
        System.out.println("res = "+factorial(4));//阶乘
    }

    public static  void print(int n){
        if (n>2){
            print(n-1);
        }
        System.out.println("n="+n);
    }
    public static  int factorial(int n){

        if (n==1){
            return 1;
        }else {
            return factorial(n-1)*n;
        }

    }
}
